home *** CD-ROM | disk | FTP | other *** search
/ PC-Blue - MS DOS Public Domain Library / PC-Blue MS-DOS Public Domain Library - NYACC.iso / vol128 / grrules < prev    next >
Encoding:
Text File  |  1986-12-15  |  1.1 KB  |  36 lines

  1. /* This is just a program fragment that illustrates the use
  2. of user definable operators. The ?-op declarations below are
  3. actually executed every time this module is loaded in, thus
  4. enabling the particular operators. Nothing to ask this one. */
  5.  
  6.  
  7.  
  8. ?-op( 100, xfx, '&' ).
  9. ?-op( 150, xfy, '->' ).
  10. ?-op( 152, yfy, '-->' ).
  11.  
  12. sentence( P ) --> noun_phrase(X,P1,P), verb_phrase(X,P1).
  13.  
  14. noun_phrase(X, P1, P ) -->
  15.    determiner(X,P2,P1,P), noun( X, P3 ),
  16.    rel_clause( X, P3, P2 ).
  17. noun_phrase( X, P, P ) --> proper_noun( X ).
  18.  
  19. verb_phrase( X, P ) --> trans_verb(X,Y, P1), noun_phrase(Y, P1, P ).
  20. verb_phrase( X, P ) --> intrans_verb(X, P ).
  21.  
  22. rel_clause(X,P1,(P1&P2)) --> [that], verb_phrase(X, P2).
  23. rel_clause(_, P, P) --> [].
  24.  
  25. determiner(X, P1, P2, all(X, (P1->P2))) --> [every].
  26. determiner(X, P1, P2, exists(X,(P1&P2))) --> [a].
  27.  
  28. noun(X, man(X) ) --> [man].
  29. noun(X, woman(X)) --> [woman].
  30.  
  31. proper_noun(john) --> [john].
  32.  
  33. trans_verb(X, Y, loves(X,Y)) --> [loves].
  34.  
  35. intrans_verb(X, lives(X) ) --> [lives].
  36.